package com.da.javatest.leetCode;

import java.util.Arrays;

/**
 * @author chenlida
 * @date 2018/12/20 14:21
 * @description
 */
public class Code908 {
    public int smallestRangeI(int[] A, int K) {
        if (A.length == 1) { return 0; }
        Arrays.sort(A);
        int max = A[A.length - 1] - 2 * K;
        return max > A[0] ? max - A[0] : 0;
    }
}
